package com.mms.controller.admin;

import com.mms.entity.model.PagerTool;
import com.mms.pojo.SysManager;
import com.mms.service.SysManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by dangz on 2017/5/21/021.
 */
@Controller
@RequestMapping("sysManager")
public class SysManagerController {
    @Autowired
    private SysManagerService sysManagerService;

    @RequestMapping("edit")
    public String edit(Long id, Model model) {
        SysManager manager = sysManagerService.get(id);
        if(manager == null){
            manager = new SysManager();
        }
        model.addAttribute("dto", manager);
        return "sysManager_input";
    }

    @ResponseBody
    @RequestMapping(value = "list")
    public Object list(PagerTool pt, HttpServletRequest req) {
        return sysManagerService.getList(pt,req);
    }
}
